package com.feihong.yw189.bluetooth.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.TextView;

import com.feihong.yw189.R;


/**
 * 写卡结果提示
 */

public class YqDialog extends Dialog {

    private Context context;
    private TextView dialog_name;
    private TextView titleCard;
    private String mStr;
    private String mTitle;

    public YqDialog(Context context) {
        super(context, R.style.QiaoDaoDialogStyle);
        this.context = context;
    }

    public void setStr(String str) {
        this.mStr = str;
    }

    public void setTitle(String str) {
        this.mTitle = str;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.yq_dialog);
        dialog_name = (TextView) findViewById(R.id.dialog_name);
        titleCard = (TextView) findViewById(R.id.titleCard);
        dialog_name.setText(mStr);
        titleCard.setText(mTitle);
    }


    @Override
    public void show() {

        super.show();
    }

    @Override
    public void dismiss() {

        super.dismiss();
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_MOVE) {
            dismiss();
            return true;
        }
        return super.onTouchEvent(event);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
            dismiss();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

}
